﻿@using WebApplication1.Models;
@using WebApplication1.Models.Database;
@{
    ViewData["Title"] = "search";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var news = ViewData["list"] as List<News>;
}
<div id="main">
      
    @{


        int row;
        if (news.Count % 2 == 0)
        {
            row = news.Count / 2;
        }
        else
        {
            row = news.Count + 1;
        }

        for(var i = 1; i <= row; i++)
        {
            <ul id="main_ul">
                @{
                    var list = news.Skip((i - 1) * 2).Take(2).ToList();
                        foreach(var item in list)
                    {
                        <li>
                            <a href="detail.html?id=@item.Id">
                            <img src="@item.Imgpath">
                            <p>@item.Title</p>
                            <p>@item.Content</p>
                            <p>发布时间：@item.Update</p>
                            </a>
                        </li>
                    }
                }
                </ul>
            }

        }
</div>